#include <iostream>
using namespace std;

class Base {
public:
    static int a;
    static void func() {
        cout << "Base - func() "  << endl;
    }
};
int Base :: a  = 10;
class Son : public Base {
public:
    static int a;
    static void func() {
        cout << "Son - func() "  << endl;
    }
};
int Son :: a = 20;
int main() {
    //通过对象访问
    Son s1;
    cout << s1.a << endl; //当子类和父类有同名静态成员变量时，子类对象访问时不加作用域 直接访问的是子类的静态成员变量
    cout <<s1.Base::a << endl;
    s1.func();
    s1.Base::func();

    //通过类名访问
    cout << Son::a << endl;
    cout << Son::Base::a << endl;
    Son::func();
    Son::Base::func();

    return 0;
}